#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
    int a, max = 0, min = 100, i = 0, d;
    scanf("%d", &a);
    for (i; i < a; i++)
    {
        scanf("%d", &d);
        if (d > max)
             max= d;
        if (d < min)
            min = d;
    }
    printf("%d", max - min);
    return 0;
}